/*  PLUTO JS -Scripting Web Server.
    Copyright (C) 2013 vivek gangadharan

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package pluto.js.api;

import java.io.OutputStream;
import java.net.HttpCookie;
import pluto.http.HTTPResponse;


public class Response {
    
    HTTPResponse response;
    
    public Response(HTTPResponse response){
        this.response=response;
    }
   

    public final Response send(String message) {
        response.send(message);
        return this;
    }

    public Response contentType(String type) {
        response.type(type);
        return this;
    }

    public String contentType() {
        return response.type();
    }

    public Response cookie(HttpCookie cookie) {
        response.cookie(cookie);
        return this;
    }
   
      public Response sendFile(String filePath) {
        response.setIsFileDispatch(true);
        response.sendFile(filePath);
        return this;
    }
    
      public Response header(String key, String value) {
        response.header(key, value);
        return this;
    }

    public String header(String key) {
        return response.header(key);
    }

     public OutputStream outputStream() {
        return response.outputStream();
    }

   

    public Response redirect(String redirectUrl) {
        response.redirect(redirectUrl);
        return this;
    }
    
     
    public Response removeHeader(String key) {
        response.removeHeader(key);
        return this;
    }
    
     public Response responseCode(String responseCode) {
        response.response(responseCode);
        return this;
    }

    public String responseCode() {
        return response.response();
    }
    
    @Override
    public String toString(){
        return "Response";
    }
}
